package com.firstcare.android_dylibrary.bean;

import com.alibaba.fastjson.JSONObject;
import com.firstcare.android_dylibrary.DYApplication;
import com.firstcare.android_dylibrary.bean.base.BaseModelProxy;
import com.firstcare.android_dylibrary.network.URLSet;
import com.firstcare.android_dylibrary.network.request.ModelListRequest;
import com.rdxer.xxlibrary.HTTPUtils.listener.ErrorListener;
import com.rdxer.xxlibrary.HTTPUtils.listener.FailedListener;
import com.rdxer.xxlibrary.HTTPUtils.listener.OKListener;

import java.util.List;

/**
 * Created by chenyichao on 2016/8/2.
 */
public class SystemAlarmProxy extends BaseModelProxy<SystemAlarm> {
    /**
     *  不使用缓存
     */
    public static void getAlarmProxyListNoCache(final OKListener<List<SystemAlarmProxy>> okListener, FailedListener failedListener, ErrorListener errorListener) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type","2");
        ModelListRequest<SystemAlarmProxy> request = new ModelListRequest<SystemAlarmProxy>(URLSet.getAlarmList, jsonObject, okListener, failedListener, errorListener) {
            @Override
            protected Object getTargetData(JSONObject response) throws Exception {
                return response.getJSONObject("data").getJSONArray("esAlarmList");
            }
        };
        DYApplication.getShared().getApi().addToRequestQueue(request);
    }
}
